<include file="Public/min-header" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<style>
	th{text-align: center;}
</style>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
	<section class="content">
       <div class="row">
       		<div class="col-xs-12">
	       		<div class="box">
	             <div class="box-header">
	             <div class="row">
  					<div class="col-md-10">
  						<form action="" method="get">
<!-- 		  					<div class="col-xs-2">
		  						<div class="form-group margin">
				                  <select name="cat_id" id="cat_id" class="form-control">
				                    <option value="0">所有分类</option>
				                    <foreach name="categoryList" item="v" key="k" >
				                        <option value="{$v['id']}" <if condition="$cat_id eq $v[id]">selected</if>> {$v['name']}</option>
							 		</foreach>
				                  </select>
			                  </div>
		  					</div>	
		  					<div class="col-xs-2">
		  					    <div class="form-group margin">
				                  <select name="brand_id" id="brand_id" class="form-control">
				                    <option value="0">所有品牌</option>
				                        <foreach name="brandList" item="v" key="k" >
				                           <option value="{$v['id']}" <if condition="$brand_id eq $v[id]">selected</if>>{$v['name']}</option>
										</foreach>
				                  </select>
				                </div>
                			</div>	 -->
							<?php
							if(session('fenbu_id')==0){
							?>
							<div class="col-xs-2">
							<div class="form-group">
							 <select name="fenbu_id" id="fenbu_id" class="input-sm" style="width:120px;height:33px;line-height:33px;">
							     <option value="">全部</option>
								<foreach name="fenbu_list" item="v">
								   <option value="{$v['fenbu_id']}" <?php if(I('fenbu_id')==$v['fenbu_id']){ ?> selected="selected" <?php } ?>>
									{$v['fenbu_name']}
								   </option>
								</foreach>
							</select>
							</div>
							</div>
							<?php
							}else{
								echo '<input type="hidden" name="fenbu_id" id="fenbu_id" value="'.session('fenbu_id').'" />';
							}
							?>
							<div class="col-xs-2">
								<div class="form-group">
									<div class="input-group">
										<input type="text" name="kehu" value="{:I('kehu')}" placeholder="店铺名" id="input-email" class="form-control">
										</div>
									</div>
								</div>
				  			<div class="col-xs-4">
					            <div class="input-group">
						            <div class="input-group-addon">
						               	选择时间  <i class="fa fa-calendar"></i>
						            </div>
					               <input type="text" class="form-control pull-right" name="timegap" value="{$timegap}" id="start_time">
					            </div>
				  			</div>	
				  			 <button type="button" class="btn btn-default pull-right" id="daochu"><i class="fa fa-file-excel-o"></i>&nbsp;导出excel</button>  
                   		 	<div class="col-xs-1"><input class="btn btn-primary btn-info" type="submit" value="确定"></div>
                  		</form>
                 	</div>
		  		  </div>
	             </div><!-- /.box-header -->
	             <div class="box-body">
	           	 <div class="row">
	            	<div class="col-sm-12">
		              <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
		                 <thead>
		                   <tr role="row">
			                   <th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" aria-sort="ascending">ID</th>         
			                   <th class="sorting" tabindex="0" aria-controls="example1" >店铺名</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" >联系电话</th>	
			                   <!--<th class="sorting" tabindex="0" aria-controls="example1" >订单数</th>-->
							   <!--<th class="sorting" tabindex="0" aria-controls="example1" >下单人数</th>-->
			                   <th class="sorting" tabindex="0" aria-controls="example1" >销售金额</th>
							   <th class="sorting" tabindex="0" aria-controls="example1" >平台扣点</th>
							   
							   <th class="sorting" tabindex="0" aria-controls="example1" >扣点后金额</th>
							   <th class="sorting" tabindex="0" aria-controls="example1" >退货金额</th>
							   <th class="sorting" tabindex="0" aria-controls="example1" >应结算金额</th>
							   <!-- <th class="sorting" tabindex="0" aria-controls="example1" >累计销售额</th> -->
		                  	   <th class="sorting" tabindex="0" aria-controls="example1" >最后出库时间</th>
		                   </tr>
		                 </thead>
						<tbody>
                         <foreach name="list" item="vo" key="k" >
                          <tr role="row" align="center">
                          	 <td>{$vo.store_id}</td>
                             <td>{$vo.store_name}</td> 
		                     <td>{$vo.store_phone}</td>
		                     <!--<td style="color: green;">{$vo.danshu}</td>-->
							 <!--<td style="color: green;">{$vo.renshu}</td>-->
		                     <td style="color: red;">{$vo.xiaoshoue}</td>
							 <td style="color: green;">{$vo.kou_price}</td>
							 
							 <td style="color: red;">{:$vo['xiaoshoue']-$vo['kou_price']}</td>
							 <td style="color: green;">{$vo.tuihuo}</td>
							 <td style="color: red;">{:$vo['xiaoshoue']-$vo['kou_price']-$vo['tuihuo']}</td>
							 <!-- <td style="color: green;">{$vo.store_moneys}</td> -->
		                     <td>{$begin|date="Y-m-d",###}~{$end|date="Y-m-d",###}</td>
		                   </tr>
		                  </foreach>
						  <tr style="font-size: 16px;font-weight: bold;">
							  <td style="text-align:right;" colspan="3">当日销量合计：</td>
							  <td style="color: red;text-align: center;">{$heji}</td>
							  <td style="color: green;text-align: center;">{$heji_k}</td>
							  <td style="color: red;text-align: center;">{:$heji-$heji_k}</td>
							  <td style="color: green;text-align: center;"></td>
							  <td style="color: red;text-align: center;"></td>
							  <td style="color: red;text-align: center;"></td>
							  
						  </tr>
		                   </tbody>
		                 <tfoot>
		                 </tfoot>
		               </table>
	               </div>
	          </div>
              <div class="row">
              	    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$page}</div>		
              </div>
	          </div>
	        </div>
       	</div>
       </div>
   </section>
</div>
<script>
	$("#daochu").click(function(){
		var fenbu_id=$("#fenbu_id").val();
		var kehu=$("#kehu").val();
		var start_time=$("#start_time").val();
	
		location.href="/index.php/Admin/Finance/export_storeCount?fenbu_id="+fenbu_id+"&kehu="+kehu+"&timegap="+start_time;
	})
$(document).ready(function() {
	$('#start_time').daterangepicker({
			format:"YYYY-MM-DD HH:mm",
			singleDatePicker: false,
			showDropdowns: true,
			minDate:'2021-01-01 00:00',
			maxDate:'2030-01-01 00:00',
			startDate:'{:date("Y-m-d")} 00:00',
	        showWeekNumbers: true,
	        timePicker: true,
	        timePickerIncrement: 1,
	        timePicker12Hour: false,
	        ranges: {
	           '今天': [moment(), moment()],
	           '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
	           '最近7天': [moment().subtract('days', 6), moment()],
	           '最近30天': [moment().subtract('days', 29), moment()],
	           '上一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
	        },
	        opens: 'right',
	        buttonClasses: ['btn btn-default'],
	        applyClass: 'btn-small btn-primary',
	        cancelClass: 'btn-small',
		    locale : {
	            applyLabel : '确定',
	            cancelLabel : '取消',
	            fromLabel : '起始时间',
	            toLabel : '结束时间',
	            customRangeLabel : '自定义',
	            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
	            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
	            firstDay : 1
	        }
		});
});
</script>
</body>
</html>